<style>
.stepContainer p { margin: 0 0; }
.widgettitle {margin-bottom : 0;}
</style>
<div class="widgetcontent">
    <form id="form_siswa" class="stdform stdform2" method="POST" action="">
	<input type="hidden" value="<?php echo $id ?>" name="id_siswa">
	<div id="wizard" class="wizard">
		<br />
		<ul class="hormenu">
			<li>
				<a href="#wiz1step1">
					<span class="h2">Data Pertama</span>
					<span class="label">Data Pribadi Siswa</span>
				</a>
			</li>
			<li>
				<a href="#wiz1step2">
					<span class="h2">Data Kedua</span>
					<span class="label">Data Orang Tua</span>
				</a>
			</li>
			<li>
				<a href="#wiz1step3">
					<span class="h2">Data Ketiga</span>
					<span class="label">Data Wali</span>
				</a>
			</li>
		</ul>	
		<div id="wiz1step1" class="formwiz">
			<h4 class="widgettitle">Data Pertama : Pribadi Siswa</h4>
			<p>
				<label for="id_tahun">
					Tahun Masuk
				</label>
				<span class="field">
                                    <select id="id_tahun" name="id_tahun" class="uniformselect" <?php if($id != '') echo 'disabled' ?> required>
						<?php
							foreach($select_tahun->result() as $pilih_tahun) 
							{
								$selek = FALSE;
								if($pilih_tahun->id_tahun == $id_tahun) $selek = TRUE;
								echo '<option value="'.$pilih_tahun->id_tahun.'" '.set_select('id_tahun', $pilih_tahun->id_tahun, $selek).'>'.$pilih_tahun->tahun_angkatan.'</option>';
							}
						?>
					</select>
				</span>
			</p>
			<p>
				<label for="nomor_induk">
					Nomor Induk Siswa
				</label>
				<span class="field">
					<input id="nomor_induk" type="text" name="nomor_induk" required class="input-medium" maxlength="20" value="<?php echo set_value('nomor_induk', $nomor_induk) ?>" />
				</span>
			</p>
			<p>
				<label for="nama_lengkap">
					Nama Lengkap Siswa
				</label>
				<span class="field">
					<input id="nama_lengkap" class="input-xlarge" type="text" name="nama_lengkap" required maxlength="30" value="<?php echo set_value('nama_lengkap', $nama_siswa) ?>" />
				</span>
			</p>
			<p>
				<label for="jenis_kelamin">
					Jenis Kelamin
				</label>
				<span class="field">
					<select id="jenis_kelamin" name="jenis_kelamin" class="uniformselect">
						<?php 
						$jk_L = FALSE; $jk_P = FALSE;
						if($jenis_kelamin == 'L') $jk_L = TRUE; elseif($jenis_kelamin == 'P') $jk_P = TRUE ?>
						<option value="L" <?php echo set_select('jenis_kelamin', 'L', $jk_L)?>>Laki-Laki</option>
						<option value="P" <?php echo set_select('jenis_kelamin', 'P', $jk_P)?>>Perempuan</option>
					</select>
				</span>
			</p>
			<p>
				<label for="tempat_lahir">
					Tempat Lahir
				</label>
				<span class="field">
					<input id="tempat_lahir" type="text" name="tempat_lahir" required class="input-large" maxlength="30" value="<?php echo set_value('tempat_lahir', $tempat_lahir) ?>" />
				</span>
			</p>
			<p>
				<label for="tgl_lahir">
					Tanggal Lahir
				</label>
				<span class="field">
					<input id="tgl_lahir" type="text" name="tgl_lahir" required class="input-large" maxlength="30" value="<?php echo set_value('tgl_lahir', $tanggal_lahir) ?>" />
				</span>
			</p>
			<p>
				<label for="anak_ke">
					Anak Ke
				</label>
				<span class="field">
					<input id="anak_ke" type="number" name="anak_ke" required class="input-large" min=1 max=100 value="<?php echo set_value('anak_ke', $anak_ke) ?>" />
				</span>
			</p>
			<p>
				<label for="goldar">
					Golongan darah
				</label>
				<span class="field">
					<select id="goldar" name="goldar" required class="uniformselect" >
						<?php 
						$gd_A = FALSE;
						$gd_B = FALSE;
						$gd_AB = FALSE;
						$gd_O = FALSE;
						if($golongan_darah == 'A') $gd_A = TRUE; 
						elseif($golongan_darah == 'B') $gd_B = TRUE; 
						elseif($golongan_darah == 'AB') $gd_AB = TRUE; 
						elseif($golongan_darah == 'O') $gd_O = TRUE; 
						?>
						<option value="A" <?php echo set_select('goldar', 'A', $gd_A)?>>A</option>
						<option value="B" <?php echo set_select('goldar', 'B', $gd_B)?>>B</option>
						<option value="AB" <?php echo set_select('goldar', 'AB', $gd_AB)?>>AB</option>
						<option value="O" <?php echo set_select('goldar', 'O', $gd_O)?>>O</option>
					</select>
				</span>
			</p>
			<p>
				<label for="agama">
					Agama
				</label>
				<span class="field">
					<select name="agama" id="agama" class="uniformselect">
						<?php 
							$ag_is = FALSE;
							$ag_kr = FALSE;
							$ag_hd = FALSE;
							$ag_bd = FALSE;
							$ag_ka = FALSE;
							$ag_ko = FALSE;
							$ag_la = FALSE;
							if(strtoupper($agama) == 'ISLAM') $ag_is = TRUE;
							elseif(strtoupper($agama) == 'KRISTEN') $ag_kr = TRUE;
							elseif(strtoupper($agama) == 'HINDU') $ag_hd = TRUE;
							elseif(strtoupper($agama) == 'BUDHA') $ag_bd = TRUE;
							elseif(strtoupper($agama) == 'KATOLIK') $ag_ka = TRUE;
							elseif(strtoupper($agama) == 'KONGHUCHU') $ag_ko = TRUE;
							elseif(strtoupper($agama) == 'LAIN-LAIN') $ag_la = TRUE;
						?>
						<option value="Islam" <?php echo (set_select('agama', 'Islam', $ag_is)) ? 'selected' : ''; ?>>Islam</option>
						<option value="Kristen" <?php echo (set_select('agama', 'Kristen', $ag_kr)) ? 'selected' : ''; ?>>Kristen</option>
						<option value="Hindu" <?php echo (set_select('agama', 'Hindu', $ag_hd)) ? 'selected' : ''; ?>>Hindu</option>
						<option value="Budha" <?php echo (set_select('agama', 'Budha', $ag_bd)) ? 'selected' : ''; ?>>Budha</option>
						<option value="Katolik" <?php echo (set_select('agama', 'Katolik', $ag_ka)) ? 'selected' : ''; ?>>Katolik</option>
						<option value="Konghuchu" <?php echo (set_select('agama', 'Konghuchu', $ag_ko)) ? 'selected' : ''; ?>>Konghuchu</option>
						<option value="Lain-Lain" <?php echo (set_select('agama', 'Lain-Lain', $ag_la)) ? 'selected' : ''; ?>>Lain-Lain</option>
					</select>
				</span>
			</p>
			<p>
				<label for="alamat">
					Alamat
				</label>
				<span class="field">
					<textarea id="alamat" name="alamat" required id="autoResizeTA" cols="80" rows="5" class="span5" style="resize: vertical"><?php echo set_value('alamat', $alamat) ?></textarea>
				</span>
			</p>
			<p>
				<label for="kota">
					Kota
				</label>
				<span class="field">
					<input id="kota" type="text" name="kota" required class="input-medium" maxlength="20" value="<?php echo set_value('kota', $kota) ?>" />
				</span>
			</p>
			<p>
				<label for="propinsi">
					Propinsi
				</label>
				<span class="field">
					<input id="propinsi" type="text" name="propinsi" required class="input-medium" maxlength="20" value="<?php echo set_value('propinsi', $propinsi) ?>" />
				</span>
			</p>
			<p>
				<label for="nomor">
					Nomor Telepon / Handphone
				</label>
				<span class="field">
					<input id="nomor" type="text" name="nomor" required class="input-medium" maxlength="20" value="<?php echo set_value('nomor', $telepon) ?>" />
				</span>
			</p>
			<p>
				<label for="assek">
					Asal Sekolah
				</label>
				<span class="field">
					<input id="assek" type="text" name="assek" required class="input-large" maxlength="30" value="<?php echo set_value('assek', $asal_sekolah) ?>" />
				</span>
			</p>
			<p>
				<label for="nilai_un">
					Nilai UN SMP
					<small>contoh pengisian : 30.50</small>
				</label>
				<span class="field">
                                    <input id="nilai_un" type="decimal" name="nilai_un" required class="input-large" maxlength="6" onkeypress="okpNilai(event)" value="<?php echo set_value('nilai_un', $nilai_un) ?>" <?php if($id != '') echo 'disabled' ?> />
                                    <span id="pilih_kelas"></span>
				</span>
			</p>
			<p>
				<label for="no_stb">
					Nomor STB SMP
				</label>
				<span class="field">
					<input id="no_stb" type="text" name="no_stb" required class="input-large" maxlength="30" value="<?php echo set_value('no_stb', $no_stb) ?>" />
				</span>
			</p>
			<p>
				<label for="wali_murid">
					Wali Murid
					<small>Isi dengan "-" bila tidak ada</small>
				</label>
				<span class="field">
					<input id="wali_murid" type="text" name="wali_murid" required class="input-large" maxlength="30" value="<?php echo set_value('wali_murid', $wali_murid) ?>" />
				</span>
			</p>
		</div>
		<div id="wiz1step2" class="formwiz">
			<h4 class="widgettitle">Data Kedua : Orang Tua</h4>
			<p>
				<label for="nama_ayah">
					Nama Ayah
					<small>Isi dengan "-" bila tidak ada</small>
				</label>
				<span class="field">
					<input id="nama_ayah" type="text" name="nama_ayah" class="input-large" maxlength="30" value="<?php echo set_value('nama_ayah', $nama_ayah) ?>" />
				</span>
			</p>
			<p>
				<label for="kerja_ayah">
					Pekerjaan Ayah
				</label>
				<span class="field">
					<input id="kerja_ayah" type="text" name="kerja_ayah" class="input-medium" maxlength="20" value="<?php echo set_value('kerja_ayah', $kerjaan_ayah) ?>" />
				</span>
			</p>
			<p>
				<label for="nama_ibu">
					Nama Ibu
				</label>
				<span class="field">
					<input id="nama_ibu" type="text" name="nama_ibu" class="input-large" maxlength="30" value="<?php echo set_value('nama_ibu', $nama_ibu) ?>" />
				</span>
			</p>
			<p>
				<label for="kerja_ibu">
					Pekerjaan Ibu
				</label>
				<span class="field">
					<input id="kerja_ibu" type="text" name="kerja_ibu" class="input-medium" maxlength="20" value="<?php echo set_value('kerja_ibu', $kerjaan_ibu) ?>" />
				</span>
			</p>
			<p>
				<label for="alamat_ortu">
					Alamat Orang Tua
				</label>
				<span class="field">
					<textarea id="alamat_ortu" name="alamat_ortu" id="autoResizeTA" cols="80" rows="5" class="span5" style="resize: vertical"><?php echo set_value('alamat_ortu', $alamat_ortu) ?></textarea>
				</span>
			</p>
			<p>
				<label for="kota_ortu">
					Kota Orang Tua
				</label>
				<span class="field">
					<input id="kota_ortu" type="text" name="kota_ortu" class="input-medium" maxlength="20" value="<?php echo set_value('kota_ortu', $kota_ortu) ?>" />
				</span>
			</p>
			<p>
				<label for="propinsi_ortu">
					Propinsi Orang Tua
				</label>
				<span class="field">
					<input id="propinsi_ortu" type="text" name="propinsi_ortu" class="input-medium" maxlength="20" value="<?php echo set_value('propinsi_ortu', $propinsi_ortu) ?>" />
				</span>
			</p>
			<p>
				<label for="nomor_ortu">
					Nomor Telepon / HP Orang Tua
				</label>
				<span class="field">
					<input id="nomor_ortu" type="text" name="nomor_ortu" class="input-medium" maxlength="20" value="<?php echo set_value('nomor_ortu', $telepon_ortu) ?>" />
				</span>
			</p>
		</div>
		<div id="wiz1step3" class="formwiz">
			<h4 class="widgettitle">Data Ketiga : Wali</h4>
			<p>
				<label for="nama_wali">
					Nama Wali
				</label>
				<span class="field">
					<input id="nama_wali" type="text" name="nama_wali" class="input-large" maxlength="30" value="<?php echo set_value('nama_wali', $nama_wali) ?>" />
				</span>
			</p>
			<p>
				<label for="kerja_wali">
					Pekerjaan Wali
				</label>
				<span class="field">
					<input id="kerja_wali" type="text" name="kerja_wali" class="input-medium" maxlength="20" value="<?php echo set_value('kerja_wali', $kerjaan_wali) ?>" />
				</span>
			</p>
			<p>
				<label for="alamat_wali">
					Alamat Wali
				</label>
				<span class="field">
					<textarea id="alamat_wali" name="alamat_wali" id="autoResizeTA" cols="80" rows="5" class="span5" style="resize: vertical"><?php echo set_value('alamat_wali', $alamat_wali) ?></textarea>
				</span>
			</p>
			<p>
				<label for="kota_wali">
					Kota Wali
				</label>
				<span class="field">
					<input id="kota_wali" type="text" name="kota_wali" class="input-medium" maxlength="20" value="<?php echo set_value('kota_wali', $kota_wali) ?>" />
				</span>
			</p>
			<p>
				<label for="propinsi_wali">
					Propinsi Wali
				</label>
				<span class="field">
					<input id="propinsi_wali" type="text" name="propinsi_wali" class="input-medium" maxlength="20" value="<?php echo set_value('propinsi_wali', $propinsi_wali) ?>" />
				</span>
			</p>
			<p>
				<label for="nomor_wali">
					Nomor Telepon / Handphone Wali
				</label>
				<span class="field">
					<input id="nomor_wali" type="text" name="nomor_wali" class="input-medium" maxlength="20" value="<?php echo set_value('nomor_wali', $nomor_wali) ?>" />
				</span>
			</p>
		</div>       
	</div>       
    </form>
</div>

<?php echo validation_errors(); ?>

<script type="text/javascript">
	jQuery(document).ready(function(){
		// Smart Wizard 	
  		jQuery('#wizard').smartWizard(
		 {onFinish: onFinishCallback}
		);
		function onFinishCallback(){
			jQuery('#form_siswa').submit();
		} 
                
                jQuery('#nilai_un').keyup(function() {
                    if(jQuery('#nilai_un').val() >= 32)
                    {
                        jQuery('#pilih_kelas').html('Kelas : <select name="pilih_kelas" class="uniformselect" <?php if($id != '') echo 'disabled' ?> ><option value="IPA">IPA</option><option value="IPS">IPS</option></select>');
                    }
                    else
                    {
                        jQuery('#pilih_kelas').html('Kelas : <select name="pilih_kelas" class="uniformselect" disabled><option value="IPS" selected>IPS</option></select>');
                    }
                  });
                  
                  <?php if(set_value('nilai_un', $nilai_un) != '') echo "jQuery('#nilai_un').keyup();" ?>
	});
        
     function okpNilai(e){
          key = e.which ? e.which : e.keyCode;
          if(key>47 && key<58 || key == 8 || key ==9 || key == 46){
          } else {
               if(e.preventDefault){
                    e.preventDefault();
               }
          }
     }
</script>